package pri.damai.xiaowu.usercenter.sysauth.covert;

import com.google.common.collect.Lists;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import pri.damai.xiaowu.usercenter.sysauth.entity.System;
import pri.damai.xiaowu.usercenter.vo.SystemVO;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 对象转换器
 *
 * @description
 * @author YangXinFu
 * @date 13:43 2022/7/20
 **/
public class SystemConverter {

    public static List<SystemVO> convertToSysVO(List<System> systems) {
        if (CollectionUtils.isEmpty(systems)) {
            return Lists.newArrayList();
        }

        return systems.stream().map(system -> {
            SystemVO systemVO = new SystemVO();
            BeanUtils.copyProperties(system, systemVO);
            return systemVO;
        }).collect(Collectors.toList());
    }

}
